import { app } from 'electron'
import { getCommandArgs } from './env'
import windowUtils  from './windowUtils'
import { checkSecondInstance } from './utils'
import './handle'

const env = getCommandArgs()

checkSecondInstance()

app.whenReady().then(() => {
    const window = windowUtils.createMainWindow()

    if (env?.mode === 'dev') {
        window.loadURL('http://127.0.0.1:3000/#/home')
    } else {
        window.loadFile('./index.html', { hash: '#/home' })
    }

    window.once('ready-to-show', () => {
        window.show()
    })
})